UIf@\

UIfɂ

Viewɒǉzu PMXff[^(Ot@Cǂݍ݂܂̓vOC̒ڍ쐬)
vOC̊eCxgƑgݍ킹邱ƂɂAUI([U[C^[tFCX)Ƃċ@\邱Ƃ\łB

UIf͂̈ÃvOC@\yђǉzu PMXff[^ɂĂ̌ď̂ƂȂ܂B


g

UIf CvOC쐬邱Ƃł܂B
CvOC̊{IȎgɂẮuvOC_CvOC.txtvTvXNvgȂǂQƂĂB

@

PXCBridge.RegisterUIModel()

琶^o^s܂BOɊ{\ƂȂ PMXf[^쐬ĂKv܂B

UIf͎w肵 PMXf[^ύXĂ UIfɔf邱Ƃ͂܂B
xo^ UIf͖{̑ŊǗAXVɂĂ͐p̏ĂяoKv܂(XVł͈̂ꕔ̃f[^̂)


j

IPXUIModel.Release()

𒼐ڌĂяoA܂

IPXUIModel.SetAutoRelease()

Oɐݒ肵ĂKv܂B


SetAutoRelease()̓vOCIɎIɔjs悤ɐݒ肵܂A
PMXGfB^ɒʏzuvOC̏I^C~O "PMXGfB^IƓ" ɂȂ̂ŁA
ݒ̂܂܂łɖɋCtȂ\܂B
Ȃ SetAutoRelease()ݒ肵ꍇ Release()ĂяoƁAjɕs𐶂܂B
ʏ͌ʐݒɂj(Release())𐄏܂B


\

UIfł͐ݒ肳ꂽ PMX̂̋@\삵܂B
܂{̑ PMXɂ͎ĂȂ@\𗘗p邱Ƃ\łB

ΉO
Z֌W
ZtVhE
nʉe

ǉ\
[hsɂϊ
r{[h(Sʕ\^YŒ)
ގ(FȂ)̒ڍXV(ގ[t)
[x(Z)̗L
fOւ̕`
eNX`̃zu(CӕҏW\)
\@\

̑Aʏ PMXƓlɃ{[yу[tό`sƂł܂B


ȉ IPXUIModelC^[tFCX̋Lq(IPXUIModel.SetWorld()Ȃ)ȗ܂BȂǊ֐̏ڍׂ̓IuWFNguEUȂǂłmFB

{
Visible : \
Light   : Ɩ̗L
Depth   : [x(Z)̗L | ͕`掞Zobt@(O֌W)𖳎܂
TopMost : őOʕ` | PMXfƑUIf̒ōłOɕ`悵܂({[Ȃǂ̒ǉ\IuWFNg̎Oɂ͕`ł܂)

SetBillboard() : r{[hݒ | ^S^Y

r{[hɐݒ肳ꂽ UIf͏ɉʐʂIuWFNgƂȂ܂(S̏ꍇ)
l摜\ȂǏɓ\KvꍇɗLpłB

r{[h2D\Ƃ͈قȂ̂ŁA_Ɋւ炸펞ʒuTCYŕ`悷邱Ƃ͂ł܂(ʂȐݒ肪KvɂȂ܂)


ό`^XV


PXCBridge.RegisterUIModel(..., bool transform = false)
 : ɕό`^ό`s w

[hs | ό`słKp
SetWorld() : sݒ
GetWorld() : s擾

{[
SetBone()          : ʃ{[։L3(S/R/T)̈ꊇݒ
SetBoneScale()     : ʃ{[̃XP[(x/y/z)̐ݒ
SetBoneRotate()    : ʃ{[̉](NH[^jI)̐ݒ
SetBoneTranslate() : ʃ{[̈ړ(x/y/z)̐ݒ
ResetBone()        : SẴ{[̏

[t
SetMorph()         : ʃ[t̃[tl̐ݒ
ResetMorph()       : SẴ[t̏

ό`XV
UpdateTransform()  : ό`̍XV | [hs{[^[t̕ό`Kp(ό`sfɑ΂Ă͉ʂ̍ĕ`݂̂s܂)

ό`Kp̏Ԏ擾
GetTransformedVertexPosition() : _ʒu̎擾
GetTransformedVertexNormal()   : _@̎擾
GetTransformedBonePosition()   : {[ʒu̎擾
GetTransformedBoneMatrix()     : {[ό`s̎擾(_ό`ɂ̂܂܎gp\ȍs)

ގXV | ό`słKp
UpdateMaterialColor() : ގF̍XV
UpdateMaterialEdge()  : GbW̍XV | GbWF͍ގF̍XVőΉ
UpdateMaterialFlags() : ގtO̍XV | ʕ` ̂

ގ[t͍XV̍ގlɓKp܂B


{[^[tό`       -> RXg(̃ff[^𒼐ڕύX)
[hs^ގ̍XV -> RXg(`p̃p[^ݒ肷̂)


eNX`

ʏ PMXł͍ގeNX`̓t@CΏۂƂŒf[^܂񂪁A
UIfł̓ Bitmapf[^w肷邱Ƃ\łB

SetBitmapTexture()    : w̍ގeNX` BitmapeNX`ɐݒ
UpdateBitmapTexture() : eNX`f[^̍XV

舵 Bitmap̃tH[}bg 32bitARGB ̂
ToonXtBAeNX`͕ύXł܂

RȂ摜f[^̍XV̓RXgɑ傫Ȃ̂ŁA舵ɂӂB


Bitmap摜ɑ΂ĕ`恨XVɂ ViewɔCӂɕ\邱Ƃ\łB
eLXg\ɊւĂ͊ȒPȎxNXƂ PXUIModelHelper.TextControl pӂĂ܂B


Cxg

UIfɑ΂ă}EX֘ÃCxgo^邱Ƃł܂B
܂Cxgo^p̃Xi쐬Kv܂B

CreateEventListener()  : CxgXi쐬
ReleaseEventListener() : CxgXij

ɕKvȃCxgRlN^ PXCBridge.CreateEventConnector() ɂč쐬(ViewCxgƋ)

CxgXi͎w̍ގ(w)̃Cxg̈Ƃ݂ȂL̃CxgĂяo܂B


Xi͕쐬邱Ƃł܂Aɕʂ̃XȋΏۂƂȂĂގw肵ꍇA
̑Ώۗ̈悩珜OVw肵Xi֗̈悪Ϗ܂B

================================
) ގ0,1,2 ̃f̏ꍇ :

var listener_all = uim.CreateEventListener(c);   // S̈ΏۂƂXi [0,1,2]
var listener_2 = uim.CreateEventListener(c, 2);  // ގ[2]ΏۂƂXi

-> listener_all [2] ȂȂ [0,1] ΏۂƂ悤ɂȂ
================================

}EXCxgڍ
IPXUIModelEventListener

MouseOver    : }EXJ[\̈ňړĂꍇɌĂяo܂
MouseDown    : }EXJ[\̈ɂꍇɃ{^ƌĂяo܂
MouseUp      : }EXJ[\̈ɂꍇɃ{^𗣂ƌĂяo܂
MouseEnter   : }EXJ[\̈ÖɈړꍇɌĂяo܂
MouseLeave   : }EXJ[\̈ォ̈OɈړꍇɌĂяo܂
MouseDrag    : MouseDownɃhbO𑱂ĂꍇɌĂяo܂
MouseDragEnd : hbOIꍇɌĂяo܂
MouseClick   : }EXJ[\̈ɂꍇɃNbNsƌĂяo܂()
MouseDoubleClick : }EXJ[\̈ɂꍇɃ_uNbNsƌĂяo܂

MouseClickɊւĂ̒ӓ_

ʏ ClicḱARg[ MouseDownMouseUp Ƒ삳邱ƂŔF܂A
UIfɂĂ Viewʏ̃CxgpĂ邱ƂA(ꏊɊւ炸)
قڑSɂĂ MouseDownMouseUp NbNƌȂĂ܂܂B

)MouseDownhbO܂ܒ[܂ňړMouseUp ƂłNbN

[U[猩@ƂẮAWł MouseDownMouseUp 
NbNƂ݂ȂP[XƗ\ẑŁȀꍇ͈ȉ̂悤ȃCxgpĂB

================================
// ClickCxg
listener.MouseDragEnd += (object sender, PXEventArgs.UIModelMouseDrag e) => {
    // Left | Wł MouseDownMouseUp
    if (e.Button == MouseButtons.Left && e.X == e.StX && e.Y == e.StY) {
        // 
    }
};
================================

ӓ_Ȃ
MouseEnter  MouseLeave ̓CxgXV@ɂĂ͐ɓ삵ȂƂ܂(dl)


Cxg쐬⏕

PXUIModelHelper NXɂȒPȃCxg쐬邱Ƃł܂

PXUIModelHelperNX͒PȃCxg̒ǉsĂ邾Ȃ̂ŁAĂяoƐɓ삵ȂȂ܂B


}EXI[o[ɂFω(MouseEnter/MouseLeave Cxgǉ)

MaterialColorEvPara ɑΏۍގ ωFAB yїLɂFނݒ (PMXwŏΐFA͎ݒ)
PXUIModelHelper.SetMouseOverColor() Ώۍގ̃XiƎw肵p[^ŌĂяoݒ


}EXhbOɂIuWFNgړ([hsړ)

ړp̃Xi쐬A
PXUIModelHelper.SetMouseDragMove() Ăяoݒ(IPXViewControl w肷ƈړꏊ萳mɂȂ܂)

================================
// SetMouseDragMove() dl

static public void SetMouseDragMove(IPXUIModel uim, IPXUIModelEventListener listener, IPXViewControl viewCtrl = null)
{
    M stm = new M();
    V3 vp = new V3();

    listener.MouseDown += (object sender, PXEventArgs.UIModelMouse e) => {
        try {
            if (e.Button == System.Windows.Forms.MouseButtons.Left) {
                // hbOp
                stm = uim.GetWorld();

                if (viewCtrl != null) {
                    vp = viewCtrl.VCursorPosition;
                    viewCtrl.VCursorPosition = new V3(stm.M41, stm.M42, stm.M43);
                }
            }
        }
        catch (Exception ex) {
            System.Diagnostics.Debug.Assert(false, ex.Message);
        }
    };

    // hbOړ
    listener.MouseDrag += (object sender, PXEventArgs.UIModelMouseDrag e) => {
        try {
            if (e.Button == System.Windows.Forms.MouseButtons.Left) {
                M m = new M(stm);
                m.M41 += e.VDrag.X;
                m.M42 += e.VDrag.Y;
                m.M43 += e.VDrag.Z;
                uim.SetWorld(m);
            }
        }
        catch (Exception ex) {
            System.Diagnostics.Debug.Assert(false, ex.Message);
        }
    };

    if (viewCtrl != null) {
        // hbOړ
        listener.MouseDragEnd += (object sender, PXEventArgs.UIModelMouseDrag e) => {
            try {
                if (e.Button == System.Windows.Forms.MouseButtons.Left) {
                    viewCtrl.VCursorPosition = vp;
                }
            }
            catch (Exception ex) {
                System.Diagnostics.Debug.Assert(false, ex.Message);
            }
        };
    }
}

ς΃{[ړȂǂɂp\łB

================================


eLXg\

PXUIModelHelper.CreateTextControl() ɂ TextControlNX𐶐 (O BitmapeNX`ݒ͕sv)

textCtrl.Clear();            // wiFŃNA
textCtrl.DrawText("Hello."); // eLXg`
textCtrl.UpdateTextImage();  // XV

svɂȂ textCtrl.Dispose();

TextControlNX ImagevpeB(Bitmap) 𒼐ڕ`悷邱Ƃł܂B



